/*
 * CsvLoader.h
 * 			SINGLETON
 *
 *  Created on: Oct 8, 2011
 *      Author: marcos
 */

#ifndef CsvLoader_H_
#define CsvLoader_H_

#include <string>
#include <iostream>
#include <fstream>
#include "../Distrito.h"
#include "../Cargo.h"
#include "../Eleccion.h"
#include "../Votante.h"
#include "../Candidato.h"
#include "../Lista.h"
#include "../Conteo.h"
#include "../exception/CsvFormatException.h"
#include "../tree/BPlusTree_CONST.h"
#include "../tree/BPlusTree.h"
#include <list>
#include "stdlib.h"

using namespace std;

class CsvLoader {

private:
	static CsvLoader* instance;

protected:
	CsvLoader();
	void loadDistricts(char command, ifstream& stream);
	void loadElections(char command, ifstream& stream);
	void loadCandidates(char command, ifstream& stream);
	void loadLists(char command, ifstream& stream);
	void loadPositions(char command, ifstream& stream);
	void loadVoters(char command, ifstream& stream);
	void loadCounters(char command, ifstream& stream);

public:
	virtual ~CsvLoader();
	static CsvLoader* getInstance();
	void loadCsv(char command, string filePath) throw (CustomException, CsvFormatException);
};

#endif /* CsvLoader_H_ */
